\chapter{Direct and parallel calculations}\label{ch:dirpar}

In this chapter we briefly discuss aspects connected to
direct\index{direct calculation} and parallel\index{parallel calculation}
methods as implemented in the \dalton\ program. 

\section{Direct methods}\label{sec:direct}

\begin{center}
\fbox{
\parbox[h][\height][l]{12cm}{
\small
\noindent
{\bf Reference literature:}
\begin{list}{}{}
\item H.~\AA gren, O.~Vahtras, H.~Koch, P.~J\o rgensen, and
T.~Helgaker. \newblock {\em J.~Chem.~Phys.}, {\bf
98},\hspace{0.25em}6417, (1993). 
\item K.~Ruud, D.~Jonsson, P.~Norman, H.~{\AA}gren, T.~Saue,
H.~J.~Aa.~Jensen, P.~Dahle, and P.~Dahle. \newblock {\em
J.~Chem.~Phys.} {\bf 108}, 7973 (1998).
\end{list}
}}
\end{center}

The entire SCF\index{SCF}\index{HF}\index{Hartree--Fock} and Kohn--Sham DFT\index{Density Functional Theory}\index{DFT} part
of the \dalton\ code is direct, including all derivative two-electron
integrals, and all the way up to the cubic response function. To
perform a direct\index{direct calculation} calculation, all that is
required is to add the 
keyword \Key{DIRECT} in the general input section, as indicated in the
following input example for the calculation of nuclear
shieldings\index{nuclear shielding} in a
direct fashion:

\begin{verbatim}
**DALTON INPUT
.RUN PROPERTIES
.DIRECT
**WAVE FUNCTIONS
.HF
**PROPERTIES
.SHIELD
**END OF DALTON INPUT
\end{verbatim}

By default the two-electron integrals will be
screened~\cite{krdjpnhatshjajpdthjcp108}, using an increasingly
tighter integral screening threshold during the SCF iterations. Thus,
direct calculations calculated using integral screening will, when
converged, be almost as exact as the results obtained with integral
screening turned off. The thresholds can be changed with the
keywords \Key{IFTHRS} and \Key{ICEDIF}\index{integral screening} in the \Sec{TWOINT} section of the \Sec{*INTEGRALS} input module. To
turn off integral screening in direct or parallel calculations
altogether, \Key{IFTHRS} should be set to 20 or larger.

\section{Parallel methods}\label{sec:parallel}

\begin{center}
\fbox{
\parbox[h][\height][l]{12cm}{
\small
\noindent
{\bf Reference literature:}
\begin{list}{}{}
\item P.~Norman, D.~Jonsson, H.~\AA gren, P.~Dahle, K.~Ruud, T.~Helgaker,
and H.~Koch. \newblock {\em Chem.~Phys.~Lett.}, {\bf
253},\hspace{0.25em}1, (1996).
\end{list}
}}
\end{center}

As for direct methods, the entire Hartree--Fock and Kohn--Sham DFT parts of the \dalton\
program has been parallelized using MPI\index{MPI}\index{message passing} as
message passing interface.
Furthermore, the large-scale GASCI code \lucita\ 
is also available in a fully parallelized version in the \latestrelease\ release.
The use of the parallel code modules requires,
of course, that the code has been installed as a parallel
code\index{parallel calculation}, which is
being determined during the building of the program as described in
Chapter~\ref{ch:install}.

In contrast to pre-\dalton\ releases, the keyword \Key{PARALLEL} is not needed any more.
\dalton\ will automatically perform in parallel those program modules which have been
parallelized if more than one CPU node is available to the program.
Also, in contrast to the Dalton2011 release, \dalton\ will quit in some of the non-parallelized
modules (such as CC and SOPPA).

%All that is needed to do
%of changes in the \verb|DALTON.INP| file is to add the keyword
%\Key{PARALLEL} in the general input section (not required for \lucita), as demonstrated for a
%calculation of vibrational frequencies\index{vibrational frequency}:
%
%\begin{verbatim}
%**DALTON INPUT
%.RUN PROPERTIES
%.PARALLEL
%**WAVE FUNCTIONS
%.HF
%**PROPERTIES
%.VIBANA
%**END OF DALTON INPUT
%\end{verbatim}

The number of nodes\index{node} to be used in the calculation is
requested to the 
\verb|dalton| run script after the \verb|-N| option (see
Section~\ref{sec:firstcalc}), or as stated in local
documentation. Note that the master/slave\index{master}\index{slave}
paradigm employed by 
\dalton\ will leave the master mainly doing sequential parts of the
calculation and distribution of tasks, thus very little computation
compared to the \verb|N-1| slaves, see
Ref.~\cite{pndjhapdkrthhkcpl253}.

By default the two-electron integrals will be
screened~\cite{krdjpnhatshjajpdthjcp108}, using an increasingly
tighter integral screening threshold during the SCF iterations. Thus,
direct calculations calculated using integral screening will, when
converged, be almost as exact as the results obtained with integral
screening turned off. The thresholds can be changed with the
keywords \Key{IFTHRS} and \Key{ICEDIF}\index{integral screening}. To
turn of integral screening in direct or parallel calculations
altogether, \Key{IFTHRS} should be set to 20 or larger.

